//
//  WelcomeVC.swift
//  Swift微博
//
//  Created by adel on 2017/8/25.
//  Copyright © 2017年 com.bailun91. All rights reserved.
//

import UIKit
import SDWebImage
class WelcomeVC: UIViewController {
    
    @IBOutlet weak var iconViewBottomCons: NSLayoutConstraint!
    @IBOutlet weak var iconImgView: UIImageView!

    override func viewDidLoad() {
        super.viewDidLoad()
        
        iconImgView.layer.cornerRadius = 45
        iconImgView.layer.masksToBounds = true
        
        /// 1.设置头像
        let profileURLString = UserAccountViewModel.sharedUserAccountViewModel.account?.avatar_large
        
        let url = NSURL(string: profileURLString ?? "")
        
        iconImgView.sd_setImage(with: url! as URL, placeholderImage: UIImage.init(named: "avatar_default_big"))
        
        // 1.改变约束的值
        iconViewBottomCons.constant = UIScreen.main.bounds.height - 200
        
        // 2.执行动画
      
        UIView.animate(withDuration: 2.5, delay: 0.001, usingSpringWithDamping: 0.8, initialSpringVelocity: 5.0, options: [], animations: {
                self.view.layoutIfNeeded()
        }) { (_) in
            
            UIApplication.shared.keyWindow?.rootViewController = UIStoryboard(name: "Main", bundle: nil).instantiateInitialViewController()!
            
        }
    }
    

    
}

